#pragma once

#include "State.h"
#include "BallSmackers.h"
#include "Ball.h"
#include "d3dUtil.h"


class GamePlay:public State
{
private:
	Ball* ball[MAXPLAYERS];
	char choice;
	static GamePlay* init;

	//camera stuffs and others
	float mCameraRotationY;
	float mCameraRadius;
	float mCameraHeight;

	D3DXMATRIX mView;
	D3DXMATRIX mProj;

	float ballx[MAXPLAYERS];
	float ballz[MAXPLAYERS];


	//effects object and buffer object for effect
	ID3DXEffect* mFX;

	//handles for technique and world, view, proj matrices (combined)
	D3DXHANDLE mhTech;
	D3DXHANDLE mhWVP;

	
	
	void setupFX();
	void cleanUp();


public:
	GamePlay();
	void Enter();
	void Execute(D3DApp* g);
	void Exit();
	static GamePlay* Instance();	
	void Draw();
	//camera and matrix build functions
	void buildViewMtx();
	void buildProjMtx();
	void update(float dt);
	void collision();
	double distance(Ball*, Ball*);
	double changeVelX(Ball* &, int, float);
	double changeVelZ(Ball* &, int, float);
};